using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;

namespace Tvnc;

public partial class VncItemEdit : Window
{
    public Action<VncItem>? SaveClick { get; set; }


    public static readonly StyledProperty<VncItem> VncItemProperty =
        AvaloniaProperty.Register<VncItemEdit, VncItem>(nameof(VncItem));

    public VncItem VncItem
    {
        get => GetValue(VncItemProperty);
        set => SetValue(VncItemProperty, value);
    }

    public VncItemEdit()
    {
        InitializeComponent();
    }

    private void SaveButton_OnClick(object? sender, RoutedEventArgs e)
    {
        SaveClick?.Invoke(VncItem);
        this.Close();
    }
}